home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crosscountry USA Photo Safari
/
Crosscountry USA Photo Safari.iso
/
Data
/
cc_base
/
pak00_16bit_f.pk3
/
photo_album.gl.p
< prev
next >
Wrap
Text File
|
2003-01-03
|
28KB
|
631 lines
{
Hidden = TRUE;
ChildID = {
GuiAnimation("background") {
AnimationID = "image/photo_album.pcx";
X = 0;
Y = 0;
},
GuiTextInput("screen_name") {
X = 30;
Y = 40;
Width = 75;
Height = 20;
FontID = "font/verdana_9.tf";
InputDisabled = TRUE;
InputText = Mangle(348/*"Photo Album"*/);
},
GuiLayer("picture"){
X = 22;
Y = 63;
Height = 392;
Width = 210;
ChildID = {
GuiListbox("list_picture") {
X = 0;
Y = 28;
Height = 367;
Width = 208;
ListHilightedColor = #8EC2E3;
FontID = "font/verdana_black_14.tf";
StrListID = "Player1PhotoCity";
ScriptID = script {
@hide {
ResPropSetStr(GuiChildByName(SELF,"photo_picture/front_picture"), "last_photo", "");
AudioStop(CVarGetInt("narration_sound_id"));
}
@play_narration {
resid commodity_data_id;
resid Player;
int get_row;
str path;
str filename;
str cur_photo;
if ( AudioIsPlaying(CVarGetInt("narration_sound_id")) ) {
AudioStop(CVarGetInt("narration_sound_id"));
stop;
}
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
cur_photo = ResPropGetStr(Player, "photo_current");
if (StrExact(cur_photo,"")) {
stop;
}
commodity_data_id = ResPropGetResID(ResByName("CSVData"), "commodity_id");
path = "csv_data/commodity/";
get_row = CSVSearch(commodity_data_id, "Name", cur_photo);
filename = CSVGetStr(commodity_data_id, "sound", get_row);
if (StrExact(filename,"")) {
ResPropSetInt(GuiChildByName(SELF,"play_narration"),"Hidden",TRUE);
stop;
}
ResPropSetInt(GuiChildByName(SELF,"play_narration"),"Hidden",FALSE);
path = StrFormatStr("%s%s",path,filename);
CVarSetInt("narration_sound_id", AudioPlay(ResByName(path)));
}
@update_picture {
resid commodity_data_id;
resid Player;
int get_row;
str path;
str filename;
str label;
str credit;
str cur_photo;
str photo_description;
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
/* extract commodity data */
cur_photo = ResPropGetStr(Player, "photo_current");
if (StrExact(cur_photo,"")) {
stop;
}
commodity_data_id = ResPropGetResID(ResByName("CSVData"), "commodity_id");
path = "csv_data/commodity/";
get_row = CSVSearch(commodity_data_id, "Name", cur_photo);
if (CVarGetInt("cur_photo_num") == 1) {
filename = CSVGetStr(commodity_data_id, "front", get_row);
label = CSVGetStr(commodity_data_id, StrFormatStr("front_caption", CVarGetInt("cur_photo_num")), get_row);
credit = CSVGetStr(commodity_data_id, StrFormatStr("front_credit", CVarGetInt("cur_photo_num")), get_row);
} else {
filename = CSVGetStr(commodity_data_id, StrFormatStr("front%d",CVarGetInt("cur_photo_num")), get_row);
label = CSVGetStr(commodity_data_id, StrFormatStr("front%d_caption",CVarGetInt("cur_photo_num")), get_row);
credit = CSVGetStr(commodity_data_id, StrFormatStr("front%d_credit",CVarGetInt("cur_photo_num")), get_row);
}
ResPropSetStr(GuiChildByName(SELF,"photo_label"), "InputText", label);
ResPropSetStr(GuiChildByName(SELF,"photo_credit"),"InputText", credit);
if (StrExact(filename,"")) {
stop;
}
/* check if there is a next picture and if not hide next picture */
if (StrExact(CSVGetStr(commodity_data_id, StrFormatStr("front%d",CVarGetInt("cur_photo_num")+1), get_row),"")) {
ResPropSetInt(GuiChildByName(SELF,"next_picture"),"Hidden",TRUE);
} else {
ResPropSetInt(GuiChildByName(SELF,"next_picture"),"Hidden",FALSE);
}
/* check if there is a prev picture and if not hide prev picture */
if (CVarGetInt("cur_photo_num") == 2) {
ResPropSetInt(GuiChildByName(SELF,"prev_picture"),"Hidden",FALSE);
} else {
if (StrExact(CSVGetStr(commodity_data_id, StrFormatStr("front%d",CVarGetInt("cur_photo_num")-1), get_row),"")) {
ResPropSetInt(GuiChildByName(SELF,"prev_picture"),"Hidden",TRUE);
} else {
ResPropSetInt(GuiChildByName(SELF,"prev_picture"),"Hidden",FALSE);
}
}
path = StrFormatStr("%s%s",path,filename);
ResPropSetResID(GuiChildByName(SELF,"photo_picture/front_picture"), "AnimationID", ResByName(path));
}
@show {
resid Player;
resid photo_data_id;
resid player_photo;
resid cur_photo_type;
resid city_tab_id;
resid postcard_tab_id;
resid commodity_tab_id;
str cur_photo;
str photo_description;
str photo_picture_front_path;
str photo_picture_back_path;
str photo_picture_front_name;
str photo_picture_back_name;
str last_photo;
str city_caption;
int get_row;
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
release("laptop_photo");
mark("laptop_photo");
cur_photo = ResPropGetStr(Player, "photo_current");
last_photo = ResPropGetStr(GuiChildByName(SELF,"photo_picture/front_picture"), "last_photo");
cur_photo_type = ResPropGetResID(Player, "photo_current_type");
ResPropSetResID(SELF,"StrListID",cur_photo_type);
if (cur_photo_type == ResPropGetResID(Player, "photo_commodity")) {
/* set the current photo num to 1 */
CVarSetInt("cur_photo_num", 1);
ResParseEvent(SELF,"@update_picture");
} else {
ResPropSetInt(GuiChildByName(SELF,"next_picture"),"Hidden",TRUE);
ResPropSetInt(GuiChildByName(SELF,"prev_picture"),"Hidden",TRUE);
ResPropSetInt(GuiChildByName(SELF,"play_narration"),"Hidden",TRUE);
}
/* change photo if cur_photo != last photo */
if (!StrExact(cur_photo,last_photo)) {
/* nothing to highlight when there are no photo */
if (ResPropGetInt(cur_photo_type, "Count") != 0 ) {
GuiListboxSetSelected(SELF, cur_photo);
}
/* extract photo data from csv*/
if (cur_photo_type == ResPropGetResID(Player, "photo_commodity")) {
/* extract commodity data */
photo_data_id = ResPropGetResID(ResByName("CSVData"), "commodity_id");
photo_picture_front_path = "csv_data/commodity/";
get_row = CSVSearch(photo_data_id, "Name", cur_photo);
if (! StrExact(CSVGetStr(photo_data_id, "sound", get_row),"")) {
ResPropSetInt(GuiChildByName(SELF,"play_narration"),"Hidden",FALSE);
}
/* get commodity photo data from photo_com_data.csv */
photo_picture_front_name = CSVGetStr(photo_data_id, "front", get_row);
photo_picture_back_name = "";
photo_description = CSVGetStr(photo_data_id, "description", get_row);
/* change to commodity tab */
city_tab_id = ResByName("photo_album.gl/picture/city_tab");
postcard_tab_id = ResByName("photo_album.gl/picture/postcard_tab");
commodity_tab_id = ResByName("photo_album.gl/picture/commodity_tab");
ResPropSetResID(city_tab_id, "ActiveButtonID", GuiChildByName(city_tab_id,"city_tab_off"));
ResPropSetResID(postcard_tab_id, "ActiveButtonID", GuiChildByName(postcard_tab_id,"postcard_tab_off"));
ResPropSetResID(commodity_tab_id, "ActiveButtonID", GuiChildByName(commodity_tab_id,"commodity_tab_on"));
/* set the caption to that of the current photo */
ResPropSetStr(GuiChildByName(SELF,"photo_label"), "InputText", CSVGetStr(photo_data_id, "front_caption", get_row));
ResPropSetStr(GuiChildByName(SELF,"photo_credit"),"InputText", CSVGetStr(photo_data_id, "front_credit", get_row));
/* display photo description */
ResPropSetStr(GuiChildByName(SELF,"photo_description"),"InputText", photo_description);
} else if (cur_photo_type == ResPropGetResID(Player, "photo_postcard")) {
ResPropSetStr(GuiChildByName(SELF,"photo_credit"),"InputText", "");
/* extract postcard data */
photo_data_id = ResPropGetResID(ResByName("CSVData"), "postcard_id");
photo_picture_front_path = "csv_data/postcard/";
photo_picture_back_path = "csv_data/postcard/";
get_row = CSVSearch(photo_data_id, "Name", cur_photo);
/* get postcard photo data from postcard_data.csv */
photo_picture_front_name = CSVGetStr(photo_data_id, "front", get_row);
photo_picture_back_name = CSVGetStr(photo_data_id, "back", get_row);
photo_description = CSVGetStr(photo_data_id, "description", get_row);
/* change to postcard tab */
city_tab_id = ResByName("photo_album.gl/picture/city_tab");
postcard_tab_id = ResByName("photo_album.gl/picture/postcard_tab");
commodity_tab_id = ResByName("photo_album.gl/picture/commodity_tab");
ResPropSetResID(city_tab_id, "ActiveButtonID", GuiChildByName(city_tab_id,"city_tab_off"));
ResPropSetResID(postcard_tab_id, "ActiveButtonID", GuiChildByName(postcard_tab_id,"postcard_tab_on"));
ResPropSetResID(commodity_tab_id, "ActiveButtonID", GuiChildByName(commodity_tab_id,"commodity_tab_off"));
/* set the caption to that of the current photo */
ResPropSetStr(GuiChildByName(SELF,"photo_label"),"InputText", cur_photo);
/* display photo description */
ResPropSetStr(GuiChildByName(SELF,"photo_description"),"InputText", photo_description);
} else if (cur_photo_type == ResPropGetResID(Player, "photo_city")) {
ResPropSetStr(GuiChildByName(SELF,"photo_credit"),"InputText", "");
/* extract city data */
photo_data_id = ResPropGetResID(ResByName("CSVData"), "city_id");
photo_picture_front_path = "csv_data/city/";
get_row = CSVSearch(photo_data_id, "name", cur_photo);
/* get city photo data from photo_city_data.csv */
photo_picture_front_name = CSVGetStr(photo_data_id, "city_image", get_row);
photo_picture_back_name = "";
city_caption = CSVGetStr(photo_data_id, "caption", get_row);
photo_description = CSVGetStr(photo_data_id, "description", get_row);
if (!StrExact("", city_caption)) {
photo_description = StrFormatStr("%s\n\n%s",city_caption, photo_description);
}
/* set the caption to that of the current photo */
ResPropSetStr(GuiChildByName(SELF,"photo_label"),"InputText", cur_photo);
/* display photo description */
ResPropSetStr(GuiChildByName(SELF,"photo_description"),"InputText", photo_description);
/* change to city tab */
city_tab_id = ResByName("photo_album.gl/picture/city_tab");
postcard_tab_id = ResByName("photo_album.gl/picture/postcard_tab");
commodity_tab_id = ResByName("photo_album.gl/picture/commodity_tab");
ResPropSetResID(city_tab_id, "ActiveButtonID", GuiChildByName(city_tab_id,"city_tab_on"));
ResPropSetResID(postcard_tab_id, "ActiveButtonID", GuiChildByName(postcard_tab_id,"postcard_tab_off"));
ResPropSetResID(commodity_tab_id, "ActiveButtonID", GuiChildByName(commodity_tab_id,"commodity_tab_off"));
}
/* set current photo to last photo */
ResPropSetStr (GuiChildByName(SELF,"photo_picture/front_picture"), "last_photo", cur_photo);
ResPropSetResID(GuiChildByName(SELF,"photo_picture/front_picture"), "last_photo_type", cur_photo_type);
if (cur_photo_type == ResPropGetResID(Player, "photo_city")) {
ResPropSetStr(Player, "photo_last_city", cur_photo);
} else if (cur_photo_type == ResPropGetResID(Player, "photo_postcard")) {
ResPropSetStr(Player, "photo_last_postcard", cur_photo);
} else if (cur_photo_type == ResPropGetResID(Player, "photo_commodity")) {
ResPropSetStr(Player, "photo_last_commodity", cur_photo);
}
/* hide flip button when there r no back photo */
if (StrExact(photo_picture_back_name, "")) {
ResPropSetInt(GuiChildByName(SELF,"flip_photo_button"),"Hidden", TRUE);
} else {
ResPropSetInt(GuiChildByName(SELF,"flip_photo_button"),"Hidden", FALSE);
}
/* displays front photo */
if (!(StrExact(photo_picture_front_name, ""))) { /* image size is 270*180 */
photo_picture_front_path = StrFormatStr("%s%s", photo_picture_front_path, photo_picture_front_name);
ResPropSetResID(GuiChildByName(SELF,"photo_picture/front_picture"), "AnimationID", ResByName(photo_picture_front_path));
ResPropSetInt(GuiChildByName(SELF,"photo_picture/front_picture"),"Hidden", FALSE);
ResPropSetInt(GuiChildByName(SELF,"photo_picture/back_picture"),"Hidden", TRUE);
/* displays back photo */
if (!(StrExact(photo_picture_back_name, ""))) {
photo_picture_back_path = StrFormatStr("%s%s", photo_picture_back_path, photo_picture_back_name);
ResPropSetResID(GuiChildByName(SELF,"photo_picture/back_picture"), "AnimationID", ResByName(photo_picture_back_path));
ResPropSetInt (GuiChildByName(SELF,"photo_picture/front_picture"),"Hidden", FALSE);
}
} else {
/* hide front_picture layer if no photo */
ResPropSetInt(GuiChildByName(SELF,"photo_picture/front_picture"),"Hidden", TRUE);
}
} /* END OF IF cur_photo != last_photo */
}
@activate{
resid Player;
str selected_photo_name;
Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
selected_photo_name = GuiListboxGetSelected(SELF);
ResPropSetStr(Player, "photo_current", selected_photo_name);
ResPropSetInt(ResByName("photo_album.gl/picture/list_picture"),"Hidden",TRUE);
ResPropSetInt(ResByName("photo_album.gl/picture/list_picture"),"Hidden",FALSE);
}
}; /* END OF LIST_PICTURE SCRIPT */
ChildID = {
GuiScrollBar ("sb") {
Kind = VERTICAL;
ChildID = {
GuiButton("thumb") {
StyleID = "gui/laptop/scrollbar/sb_thumb.gbs";
},
GuiButton("dec") {
StyleID = "gui/laptop/scrollbar/sb_uarrow.gbs";
},
GuiButton("inc") {
StyleID = "gui/laptop/scrollbar/sb_darrow.gbs";
}
};
},
GuiLayer("photo_picture") {
X = 240;
Y = -20;
Hidden = FALSE;
ChildID = {
GuiPhotoDisplay("front_picture") {
X = 0;
Y = 0;
},
GuiPhotoDisplay("back_picture") {
X = 0;
Y = 0;
}
};
},
GuiButton("play_narration") {
X = 530;
Y = 5;
StyleID = "gui/bs/play_sound.gbs";
AutoSize = HEIGHT;
Hidden = 1;
ScriptID = Script {
@activate {
ResParseEvent(GuiParent(SELF),"@play_narration");
}
};
},
GuiButton("next_picture") {
X = 515;
Y = 95;
StyleID = "gui/bs/next_picture.gbs";
AutoSize = HEIGHT;
ScriptID = Script {
@activate {
CVarSetInt("cur_photo_num",CVarGetInt("cur_photo_num") + 1);
ResParseEvent(GuiParent(SELF),"@update_picture");
}
};
},
GuiButton("prev_picture") {
X = 515;
Y = 130;
StyleID = "gui/bs/prev_picture.gbs";
AutoSize = HEIGHT;
ScriptID = Script {
@activate {
CVarSetInt("cur_photo_num",CVarGetInt("cur_photo_num") - 1);
ResParseEvent(GuiParent(SELF),"@update_picture");
}
};
},
GuiButton("flip_photo_button") {
X = 535;
Y = 50;
StyleID = "gui/bs/flip.gbs";
AutoSize = HEIGHT;
Hidden = TRUE;
ScriptID = Script {
@activate {
trace(1);
if (ResPropGetInt(GuiSiblingByName("photo_picture/front_picture"),"Hidden") == 0) {
ResPropSetInt(GuiSiblingByName("photo_picture/front_picture"),"Hidden", TRUE);
ResPropSetInt(GuiSiblingByName("photo_picture/back_picture"),"Hidden", FALSE);
} else {
ResPropSetInt(GuiSiblingByName("photo_picture/front_picture"),"Hidden", FALSE);
ResPropSetInt(GuiSiblingByName("photo_picture/back_picture"),"Hidden", TRUE);
}
}
};
},
GuiTextInput("photo_label") {
X = 210;
Y = 166;
Height = 23;
Width = 390;
FontID = "font/verdana_black_bold_12.tf";
InputDisabled = TRUE;
InputText = "";
},
GuiTextInput("photo_credit") {
X = 255;
Y = 135;
Height = 40;
Width = 240;
WordWrap = 1;
FontID = "font/arial_12.tf";
InputDisabled = TRUE;
InputText = "";
},
GuiTextInput("photo_description") {
X = 211;
Y = 189;
Width = 389;
Height = 179;
WordWrap = 1;
InputDisabled = TRUE;
FontID = "font/arial_black_14.tf";
InputText = 4096 : "";
ChildID = {
GuiScrollBar ("sb") {
Kind = VERTICAL;
ChildID = {
GuiButton("thumb") {
StyleID = "gui/laptop/scrollbar/sb_thumb.gbs";
},
GuiButton("dec") {
StyleID = "gui/laptop/scrollbar/sb_uarrow.gbs";
},
GuiButton("inc") {
StyleID = "gui/laptop/scrollbar/sb_darrow.gbs";
}
};
}
}; /* END OF POSTCARD_DESCR ChildID */
} /* END OF POSTCARD_DESCR */
}; /* END OF LIST_PICTURE ChildID */
},
/*==============================*/
GuiButtonGroup("city_tab") {
X = 0;
Y = 0;
Width=100;
RadioGroupID = 1;
ScriptID = Script {
@activate {
resid Player;
resid player_photo;
resid Game;
resid front_picture_id;
resid list_picture_id;
resid photo_city_list_id;
Game = ResByName("Game");
Player = ResPropGetResID(Game,"game_cur_player");
front_picture_id = ResByName("photo_album.gl/picture/list_picture/photo_picture/front_picture");
photo_city_list_id = ResPropGetResID(Player, "photo_city");
ResPropSetStr(Player, "photo_current", ResPropGetStr(Player, "photo_last_city"));
ResPropSetResID(Player, "photo_current_type", photo_city_list_id);
list_picture_id = ResByName("photo_album.gl/picture/list_picture");
ResPropSetInt(list_picture_id,"Hidden",TRUE);
ResPropSetInt(list_picture_id,"Hidden",FALSE);
}
};
ChildID = {
GuiButton("city_tab_off") {
Width = 70;
FontID = "font/verdana_9.tf";
TextID = Mangle(349/*"City"*/);
UpID = "gui/laptop/map_button/tab_off.pcx";
},
GuiButton("city_tab_on") {
Width = 70;
FontID = "font/verdana_9.tf";
TextID = Mangle(350/*"City"*/);
UpID = "gui/laptop/map_button/tab_on.pcx";
}
};
},
GuiButtonGroup("postcard_tab") {
X = 68;
Y = 0;
Width=100;
RadioGroupID = 1;
ScriptID = Script {
@activate {
resid Player;
resid player_photo;
resid Game;
resid front_picture_id;
resid list_picture_id;
resid photo_postcard_list_id;
Game = ResByName("Game");
Player = ResPropGetResID(Game,"game_cur_player");
front_picture_id = ResByName("photo_album.gl/picture/list_picture/photo_picture/front_picture");
photo_postcard_list_id = ResPropGetResID(Player, "photo_postcard");
ResPropSetStr(Player, "photo_current", ResPropGetStr(Player, "photo_last_postcard"));
ResPropSetResID(Player, "photo_current_type", photo_postcard_list_id);
list_picture_id = ResByName("photo_album.gl/picture/list_picture");
ResPropSetInt(list_picture_id,"Hidden",TRUE);
ResPropSetInt(list_picture_id,"Hidden",FALSE);
}
};
ChildID = {
GuiButton("postcard_tab_off") {
Width = 70;
FontID = "font/verdana_9.tf";
TextID = Mangle(351/*"Postcard"*/);
UpID = "gui/laptop/map_button/tab_off.pcx";
},
GuiButton("postcard_tab_on") {
Width = 70;
FontID = "font/verdana_9.tf";
TextID = Mangle(352/*"Postcard"*/);
UpID = "gui/laptop/map_button/tab_on.pcx";
}
};
},
GuiButtonGroup("commodity_tab") {
X = 136;
Y = 0;
Width=100;
RadioGroupID = 1;
ScriptID = Script {
@activate {
resid Player;
resid player_photo;
resid Game;
resid front_picture_id;
resid list_picture_id;
resid photo_commodity_list_id;
Game = ResByName("Game");
Player = ResPropGetResID(Game,"game_cur_player");
front_picture_id = ResByName("photo_album.gl/picture/list_picture/photo_picture/front_picture");
photo_commodity_list_id = ResPropGetResID(Player, "photo_commodity");
ResPropSetStr(Player, "photo_current", ResPropGetStr(Player, "photo_last_commodity"));
ResPropSetResID(Player, "photo_current_type", photo_commodity_list_id);
list_picture_id = ResByName("photo_album.gl/picture/list_picture");
ResPropSetInt(list_picture_id,"Hidden",TRUE);
ResPropSetInt(list_picture_id,"Hidden",FALSE);
}
};
ChildID = {
GuiButton("commodity_tab_off") {
Width = 70;
FontID = "font/verdana_9.tf";
TextID = Mangle(353/*"Commodity"*/);
UpID = "gui/laptop/map_button/tab_off.pcx";
},
GuiButton("commodity_tab_on") {
Width = 70;
FontID = "font/verdana_9.tf";
TextID = Mangle(354/*"Commodity"*/);
UpID = "gui/laptop/map_button/tab_on.pcx";
}
};
} /* END OF commodity_tab */
}; /* END OF PICTURE ChildID */
}
}; /* END OF MAIN ChildID */
}